//
//  HomeTopItem.m
//  美团
//
//  Created by Ansen on 15-3-4.
//  Copyright (c) 2015年 Ansen. All rights reserved.
//

#import "HomeTopItem.h"

@interface HomeTopItem ()

@property (weak, nonatomic) IBOutlet UIButton *iconButton;

@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UILabel *subTitleLabel;


@end

@implementation HomeTopItem

+(instancetype)item
{
    return [[[NSBundle mainBundle] loadNibNamed:@"HomeTopItem" owner:nil options:nil] lastObject];
}

-(void)addTarget:(id)target action:(SEL)action
{
    [_iconButton addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
}

-(void)awakeFromNib
{
    self.autoresizingMask = UIViewAutoresizingNone;
}

-(void)setTitle:(NSString *)title
{
    self.titleLabel.text = title;
}

-(void)setSubtitle:(NSString *)subtitle
{
    self.subTitleLabel.text = subtitle;
}

-(void)setIcon:(NSString *)icon highIcon:(NSString *)highicon
{
    [self.iconButton setImage:[UIImage imageNamed:icon] forState:UIControlStateNormal];
    [self.iconButton setImage:[UIImage imageNamed:highicon] forState:UIControlStateHighlighted];
}

@end
